Fix prefix bindings in which-key-show-major-mode
authorJustin Burkett <justin@burkett.cc>
Thu, 31 May 2018 01:43:50 +0000 (21:43 -0400)
committerJustin Burkett <justin@burkett.cc>
Thu, 31 May 2018 01:45:26 +0000 (21:45 -0400)
which-key.el

index c6b89baf934930a9cb56ed952064b580efee453f..e371895cb84a9d9e3da7372181b1632e916f5c36 100644 (file)
@@ -1476,16 +1476,21 @@ which are strings. KEY is of the form produced by `key-binding'."
       (intern (cdr keydesc))))
 
 (defun which-key--map-binding-p (map keydesc)
+  "Does MAP contain KEYDESC = (key . binding)?"
   (or
    (when (bound-and-true-p evil-state)
-     (eq (which-key--safe-lookup-key
-          map
-          (kbd (which-key--current-key-string
-                (format "<%s-state> %s" evil-state (car keydesc)))))
-         (intern (cdr keydesc))))
-   (eq (which-key--safe-lookup-key
-        map (kbd (which-key--current-key-string (car keydesc))))
-       (intern (cdr keydesc)))))
+     (let ((lookup
+            (which-key--safe-lookup-key
+             map
+             (kbd (which-key--current-key-string
+                   (format "<%s-state> %s" evil-state (car keydesc)))))))
+       (or (eq lookup (intern (cdr keydesc)))
+           (and (keymapp lookup) (string= (cdr keydesc) "Prefix Command")))))
+   (let ((lookup
+          (which-key--safe-lookup-key
+           map (kbd (which-key--current-key-string (car keydesc))))))
+     (or (eq lookup (intern (cdr keydesc)))
+         (and (keymapp lookup) (string= (cdr keydesc) "Prefix Command"))))))
 
 (defun which-key--pseudo-key (key &optional prefix)
   "Replace the last key in the sequence KEY by a special symbol